
/**
 * @标题: JavaMelody.java
 * @包名： com.tellhow.app.config
 * @功能描述：TODO
 * @作者： guo
 * @创建时间： 2018年9月3日 下午4:30:50
 * @version v1.0
 */

package com.dtguai.app.config;

import net.bull.javamelody.MonitoringFilter;
import net.bull.javamelody.SessionListener;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.boot.web.servlet.ServletListenerRegistrationBean;
import org.springframework.context.annotation.Bean;

/**
 * @author guo
 * @date 2020年4月1日13:38:18
 */

public class JavaMelodyConfiguration {

    @Bean
    public FilterRegistrationBean<MonitoringFilter> monitorFilter() {

        FilterRegistrationBean<MonitoringFilter> filterRegistrationBean = new FilterRegistrationBean<MonitoringFilter>(
                new MonitoringFilter());

        filterRegistrationBean.addUrlPatterns("/*");

        return filterRegistrationBean;

    }

    @Bean
    public ServletListenerRegistrationBean<SessionListener> sessionListener() {

        ServletListenerRegistrationBean<SessionListener> servletListenerRegistrationBean = new ServletListenerRegistrationBean<SessionListener>();

        servletListenerRegistrationBean.setListener(new SessionListener());

        return servletListenerRegistrationBean;

    }

}
